
/**
 * Java从基础到进阶
 *
 * @version 1st
 * @author
 * @see https://www.bilibili.com/video/BV1PV411Z7Mj
 */

import java.awt.*;

/**
 * 
 */
public class Cell {
    private boolean alive = false;

    public void die() {
        alive = false;
    }

    public void reborn() {
        alive = true;
    }

    public boolean isAlive() {
        return alive;
    }

    public void draw(Graphics g, int x, int y, int size) {
        g.drawRect(x, y, size, size);
        if (alive) {
            g.fillRect(x, y, size, size);
        }
    }

}

/**
 * output:
 *
 */